package com.loadmore.common.base

import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.View
import com.loadmore.common.R

/**
 *@author sunleilei
 *@date 2018/7/18
 *@time 16:14
 *
 */

abstract class BaseListFragment : BaseFragment() {

    lateinit var base_list:androidx.recyclerview.widget.RecyclerView
    abstract fun setAdapter():BaseAdapter
    lateinit var adapter:BaseAdapter

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        base_list = view.findViewById(R.id.base_list)
        base_list.isNestedScrollingEnabled = false
        base_list.layoutManager = getLayoutManager()
        adapter = setAdapter()
        base_list.adapter = adapter
    }

    public fun getLayoutManager():androidx.recyclerview.widget.RecyclerView.LayoutManager {
        return  LinearLayoutManager(context)
    }



}